package com.ticket.sass.common.entity.tenant;

import com.baomidou.mybatisplus.annotation.*;
import com.ticket.sass.common.entity.tenant.enums.TicketRefundRuleDurationScope;
import com.ticket.sass.common.entity.tenant.enums.TicketRefundRuleScope;
import com.ticket.sass.common.entity.tenant.enums.TicketRefundRuleStartScope;
import com.ticket.sass.common.entity.tenant.enums.TicketRefundRuleTakeTicketStatus;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * <p>
 * 
 * </p>
 *
 * @author ywb
 * @since 2024-03-22
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("ticket_refund_rules")
@ApiModel(value="TicketRefundRulesEntity对象", description="")
public class TicketRefundRuleEntity implements Serializable {
    @ApiModelProperty(value = "退改签规则ID")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @ApiModelProperty(value = "取票状态：0未取票，1不限")
    private TicketRefundRuleTakeTicketStatus takeTicketStatus;

    @ApiModelProperty(value = "开场范围：0开场前，1开场后")
    private TicketRefundRuleStartScope startScope;

    @ApiModelProperty(value = "时长（分钟）")
    private Integer duration;

    @ApiModelProperty(value = "时长范围")
    private TicketRefundRuleDurationScope durationScope;

    @ApiModelProperty(value = "退改范围：0不允许，1 N元/张，2免费")
    private TicketRefundRuleScope scope;

    @ApiModelProperty(value = "退改手续费，N元/张")
    private BigDecimal serviceCharge;

    @ApiModelProperty(value = "配置ID")
    private Long configId;

    @ApiModelProperty(value = "影院ID")
    private Long cinemaId;

    @ApiModelProperty(value = "租户ID")
    private Long tenantId;
    
    @ApiModelProperty(value = "创建时间")
    @TableField(fill = FieldFill.INSERT)
    public LocalDateTime createdAt;
    
    @ApiModelProperty(value = "更新时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    public LocalDateTime updatedAt;
    
    @TableField(select = false)
    @ApiModelProperty(value = "删除时间")
    @TableLogic(value = "null", delval = "now()")
    public LocalDateTime deletedAt;
    
    public TicketRefundRuleEntity() {
    }
    
    public TicketRefundRuleEntity(Short takeTicketStatus, Short startScope, Integer duration, Short durationScope, Short scope, BigDecimal serviceCharge, Long configId, Long cinemaId) {
        this.takeTicketStatus = TicketRefundRuleTakeTicketStatus.Companion.valueOf(takeTicketStatus);
        this.startScope = TicketRefundRuleStartScope.Companion.valueOf(startScope);
        this.duration = duration;
        this.durationScope = TicketRefundRuleDurationScope.Companion.valueOf(durationScope);
        this.scope = TicketRefundRuleScope.Companion.valueOf(scope);
        this.serviceCharge = serviceCharge;
        this.configId = configId;
        this.cinemaId = cinemaId;
    }
}
